#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int repeatedNTimes(vector<int>& nums)
    {
        unordered_map<int, int> hash;
        int N = nums.size() / 2;

        for (size_t i = 0; i < nums.size(); ++i)
        {
            hash[nums[i]]++;
        }

        for (const auto& e : hash)
        {
            if (e.second == N)
            {
                return e.first;
            }
        }

        return -1;
    }
};